﻿using NUnit.Framework;
using Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Searching;
using Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.ViewModels;
using System;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Tests.Unit.Searching
{
    [TestFixture]
    public class DefaultSearcherGeneratorTest
    {
        private DefaultSearcherGenerator testee;


        [SetUp]
        public void SetUp()
        {
            this.testee = new DefaultSearcherGenerator();
        }

        [Test]
        public void TestGenerate()
        {
            var searcher = this.testee.Generate("method");
            var v = new ProblemViewModel { Kind = "Method" };
            string s = v.ToString();
            Assert.IsTrue(searcher(new ProblemViewModel { Kind = "Method" }));
            Assert.IsTrue(searcher(new ProblemViewModel { Category = "Method" }));
            Assert.IsTrue(searcher(new ProblemViewModel { CheckId = "Method" }));
            Assert.IsTrue(searcher(new ProblemViewModel { Message = "Method" }));
            Assert.IsFalse(searcher(new ProblemViewModel { Kind = "Class", CheckId = "foo", Category = "bar", Message = "message" }));
        }
    }
}
